<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<html>
<head>
	<c:import url="css.jsp"></c:import>    
</head>
<body>
<c:import url="header.jsp"></c:import>
<div id="content">
<c:if test="${ fn:contains(requestScope['javax.servlet.forward.servlet_path'] , 'display')  }">
${result}
<div id="title"> All loans : </div>
<table class="gridtable">
			<thead>
				<tr>
					<th scope="col">Loan ID</th>
					<th scope="col">Item ID </th>
					<th scope="col">User ID</th>
					<th scope="col">Expiry Date</th>
					<th scope="col"> Renewals</th>
					<th scope="col">Fee</th>
					<th scope="col">Returned</th>
				
				</tr>
			</thead>
			<tbody>
			
<c:forEach items="${loans}" var="loan">
<tr>
<td>${loan.loanId } </td>
<td>${loan.itemId} </td>
<td>${loan.userId} </td>
<td>${ loan.expiryDate} </td> 
<td>${ loan.extensions} </td>
<td>${ loan.lateFees} </td>
<td>${ loan.returned} </td>

</tr>
</c:forEach>
</tbody>
</table>
</c:if>



<c:if test="${ fn:contains(requestScope['javax.servlet.forward.servlet_path'] , 'showUserLoan')  }">
${result}
<div id="title"> You have the following loans : </div>
<table class="gridtable">
			<thead>
				<tr>
					<th scope="col">Loan ID</th>
					<th scope="col">Item ID </th>
					<th scope="col">Expiry Date</th>
					<th scope="col">Extensions</th>
					<th scope="col">Fee</th>
					<th scope="col">returned </th>
				</tr>
			</thead>
			<tbody>
			
<c:forEach items="${loans}" var="loan">
<tr>
<td>${loan.loanId } </td>
<td>${loan.itemId} </td>
<td>${ loan.expiryDate} </td> 
<td>${ loan.extensions} </td>
<td>${ loan.lateFees} </td>
<td>${ loan.returned} </td>
</tr>
</c:forEach>
</tbody>
</table>
</c:if>


<c:if test="${ fn:contains(requestScope['javax.servlet.forward.servlet_path'] , 'renew')  }">
${result}
<div id="title">  You have the following extendable loans : </div>
<table class="gridtable">
			<thead>
				<tr>
					<th scope="col">Loan ID</th>
					<th scope="col">Item ID </th>
					<th scope="col">Expiry Date</th>
					<th scope="col">Extensions</th>
					<th scope="col"> Returned </th>
					<th scope="col"> Renew </th>
					<th scope="col"> Return </th>
					
				</tr>
			</thead>
			<tbody>
			
<c:forEach items="${loans}" var="loan">
<tr>
<td>${loan.loanId } </td>
<td>${loan.itemId} </td>
<td>${ loan.expiryDate} </td> 
<td>${ loan.extensions} </td>
<td>${ loan.returned} </td>
<td><a href="renewLoan.do?loanId=${ loan.loanId }">renew the loan</a> </td>
<td><a href="returnItem.do?loanId=${ loan.loanId }">return the item</a> </td>


</tr>
</c:forEach>
</tbody>
</table>
</c:if>

</div>

</body>
</html>